package cn.j0n4than.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

/**
 * @author jonathan
 * <p>
 * Admin 实体类
 */
@TableName(value = "admins", keepGlobalPrefix = true)
public class Admin {

    @TableId(type = IdType.AUTO)
    public Integer id;

    @TableField(value = "username")
    public String username;

    @TableField(value = "password")
    public String password;

    @TableField(value = "email")
    public String email;

    @TableField(value = "last_login_ip")
    public String lastLoginIp;

    @TableField(value = "last_login_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date lastLoginAt;

    @TableField(value = "created_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    public Date createdAt;

    @Override
    public String toString() {
        return "Admin{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                ", lastLoginIp='" + lastLoginIp + '\'' +
                ", lastLoginAt=" + lastLoginAt +
                ", createdAt=" + createdAt +
                '}';
    }
}
